﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Maticsoft.DBUtility;//请先添加引用

namespace BaoJian.e.control
{
    public partial class Recommand : System.Web.UI.UserControl
    {
        public string ColumnID = null;
        public int Count = 12;
        private string sql = "SELECT A.PID,A.[Name],B.[Description],A.[ImagePath]  FROM [EProduct] AS A ,[EColumn] AS B WHERE A.[PID] = B.[PID] AND [EColumnID]='{0}' ORDER BY B.[SID] desc";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                sql = string.Format(sql, ColumnID);
                SqlDataReader rd = DbHelperSQL.ExecuteReader(sql);

                //Image
                if(rd.Read())
                {
                    Image1.ImageUrl = rd["ImagePath"] as string;    
                   
                    HyperLink10.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink10.ToolTip = rd["Name"] as string;  
                }
                if(rd.Read())
                {
                    Image2.ImageUrl = rd["ImagePath"] as string;                   
                    HyperLink11.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink11.ToolTip = rd["Name"] as string; 
                }

                if(rd.Read())
                {
                    Image3.ImageUrl = rd["ImagePath"] as string;                  
                    HyperLink12.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink12.ToolTip = rd["Name"] as string;  
                }
               
                //Title
                if(rd.Read())
                {
                    HyperLink1.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink1.Text = rd["Name"] as string;
                }

                if(rd.Read())
                {
                    HyperLink2.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink2.Text = rd["Name"] as string;
                }
                if(rd.Read())
                {
                    HyperLink3.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink3.Text = rd["Name"] as string;
                }
                if(rd.Read())
                {
                    HyperLink4.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink4.Text = rd["Name"] as string;
                }
                if(rd.Read())
                {
                    HyperLink5.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink5.Text = rd["Name"] as string;
                }
                if(rd.Read())
                {
                    HyperLink6.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink6.Text = rd["Name"] as string;
                }
                if(rd.Read())
                {
                    HyperLink7.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink7.Text = rd["Name"] as string;
                }
                if(rd.Read())
                {
                    HyperLink8.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink8.Text = rd["Name"] as string;
                }
                if(rd.Read())
                {
                    HyperLink9.NavigateUrl = "../detail.aspx?pid="+rd["PID"] as string+"&TID=1";
                    HyperLink9.Text = rd["Name"] as string;
                }
            }
        }
    }
}